package com.base.common.converter;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;

import org.operamasks.faces.annotation.DefineConverter;

@DefineConverter(id = "positionConverter")
public class PositionConverter implements Converter {

	@Override
	public Object getAsObject(FacesContext arg0, UIComponent arg1, String arg2) {

		return null;
	}

	@Override
	public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2) {
		if (arg2 != null) {
			if ("true".equals(arg2.toString())) {
				return "是";
			} else if ("false".equals(arg2.toString())) {
				return "否";
			}
		}
		return null;
	}

}
